package com.zyy.proxy.demo02;

/**
 * @Description: 类描述
 * @Author: zyy
 * @Date: 2023/07/26 22:33
 */
public class UserDaoProxy implements UserDao {

    private UserDaoImpl userDao;

    public UserDaoProxy(UserDaoImpl userDao) {
        this.userDao = userDao;
    }

    @Override
    public void add() {
        log("add");
        userDao.add();

    }

    @Override
    public void update() {
        log("update");
        userDao.update();

    }

    @Override
    public void delete() {
        log("delete");
        userDao.delete();

    }

    @Override
    public void query() {
        log("query");
        userDao.query();
    }

    public void log(String msg) {
        System.out.println("[debug]调用了" + msg + "方法");
    }
}
